﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.Master" CodeBehind="ListarCategorias.aspx.cs" Inherits="BackofficeExtremeEvents.Categorias.ListarCategorias" %>

<asp:Content ID="ListarEventos" ContentPlaceHolderID="MainContent" runat="server">
<div>
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
        ConnectionString="name=extremeEventsEntities" 
        DefaultContainerName="extremeEventsEntities" 
        EntitySetName="categoria" OrderBy="it.[id_categoria]" 
        Select="it.[nome], it.[id_categoria]">
    </asp:EntityDataSource>
    <asp:GridView ID="GridView1" runat="server" 
        AllowSorting="True" AutoGenerateColumns="False" 
        DataSourceID="EntityDataSource1" onrowcommand="GridView1_RowCommand" 
        DataKeyNames="id_categoria" EnableSortingAndPagingCallbacks="True" >
        <Columns>
            <asp:BoundField DataField="nome" HeaderText="Descrição" ReadOnly="True" 
                SortExpression="nome" />
            <asp:BoundField DataField="id_categoria" HeaderText="id_categoria" 
                ReadOnly="True" SortExpression="id_categoria" Visible="False" />
            <asp:ButtonField CommandName="Editar" Text="Editar" />
            <asp:ButtonField CommandName="remover" Text="Remover" />
        </Columns>
    </asp:GridView>
    
    <asp:Button ID="btAdicionar" runat="server" Text="Nova Categoria" 
        onclick="btAdicionar_Click" />
    
    <asp:Panel ID="Painel" runat="server" Height="31px" Visible="false" >
        <asp:Label ID="Label1" runat="server" Text="Descrição:"></asp:Label>
        <asp:TextBox ID="txEditar" runat="server"></asp:TextBox>
        <asp:Button ID="btGravar" runat="server" Text="Gravar" 
            onclick="btGravar_Click" />
    </asp:Panel>
    
</div>

</asp:Content> 